package com.xiaobug.demo.alipay;

import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.view.View;

import com.ljb.commlibrary.utils.T;
import com.xiaobug.baselibrary.base.BaseActivity;
import com.xiaobug.demo.R;
import com.xiaobug.demo.alipay.adapter.MenuRecyclerListAdapter;
import com.xiaobug.demo.databinding.AlipayActivityBinding;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by ljb on 2018/5/15.
 */

public class AlipayActivity extends BaseActivity<AlipayActivityBinding> {


    public static class Presenter {
        public void onClick(View view) {
            T.showToast(view.getContext(), "点击");
        }
    }

    @Override
    protected int getRootID() {
        return R.layout.alipay_activity;
    }

    @Override
    protected void initUI(Bundle savedInstanceState, AlipayActivityBinding binding) {
        MenuRecyclerListAdapter menuRecyclerListAdapter = new MenuRecyclerListAdapter(this);
        binding.rvAllList.setLayoutManager(new LinearLayoutManager(this){
            @Override
            public boolean canScrollVertically() {
                return true;
            }
        });
        binding.rvAllList.setAdapter(menuRecyclerListAdapter);

        menuRecyclerListAdapter.setHeaderData(menuEditList);
        menuRecyclerListAdapter.setData(menuItemList);

    }


    List<ItemBean> menuItemList = new ArrayList<>();
    List<MenuItem> menuEditList = new ArrayList<>();

    {
        for (int i = 0; i < 50; i++) {
            List<MenuItem> menuItems = new ArrayList<>();
            for (int j = 0; j < 5; j++) {
                MenuItem menuItem = new MenuItem("groupId=" + j, "", "menu" + j, "菜单" + j);
                menuItems.add(menuItem);
            }
            ItemBean itemBean = new ItemBean("groupId=" + i, "分组" + i, menuItems);
            menuItemList.add(itemBean);
        }
        for (int i = 0; i < 10; i++) {
            MenuItem menuItem = new MenuItem("groupId=" + i, "", "menu" + i, "菜单" + i);
            menuEditList.add(menuItem);
        }
    }

}
